<template>
  <view class="answer-result">
    <!--考试结果页-->
    <image class="result-img" src="https://qiniu-bjjrzy.bjjrzy.com/bjupi/practice/cognPractice/complete.svg"></image>
    <view class="score">您的得分为<text>{{ fraction }}</text>分</view>
    <view class="btn-item">
      <view class="btn" @click="toAnalysis">{{ practiceSettings.analysisReport ? '查看分析报告' : '完成测评' }}</view>
    </view>
  </view>
</template>
<script>
import { mapState } from 'vuex'
export default {
  name: "result",
  data() {
    return {
      fraction: 0,
      bhCheckUuid: '',
    }
  },
  computed: {
    ...mapState(['practiceSettings'])
  },
  onLoad(option) {
    this.fraction = option.fraction
    this.bhCheckUuid = option.bhCheckUuid
  },
  methods: {
    toAnalysis() {
      if (this.practiceSettings.analysisReport) {
        uni.navigateTo({
          url: `/improve/join/examination/analysis?bhCheckUuid=${this.bhCheckUuid}`
        })
      } else {
        uni.navigateTo({
          url: `/improve/join/practiceList?practiceType=${this.practiceSettings.practiceType}`
        })
      }
    }
  }
}
</script>
<style scoped lang="scss">
.answer-result {
  background-color: #FFFFFF;
  width: 100%;
  height: 100vh;

  .result-img {
    width: 100%;
    margin-top: 20%;
  }

  .score {
    font-weight: bold;
    font-size: 16px;
    color: #333333;
    text-align: center;
    width: 100%;
    margin-top: 20px;
    letter-spacing: 1px;

    text {
      font-size: 28px;
    }
  }

  .btn-item {
    padding-top: 20px;
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
    position: fixed;
    background-color: #FFFFFF;
    bottom: 0;
    width: 100%;
    z-index: 99;

    .btn {
      background-color: #37B874;
      border-radius: 24rpx;
      width: calc(100% - 40px);
      height: 90rpx;
      text-align: center;
      line-height: 90rpx;
      font-size: 32rpx;
      color: #FFFFFF;
      margin-left: 20px;
    }
  }
}
</style>